package reduce.fz.com.reduce.custom;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import reduce.fz.com.reduce.R;

import static reduce.fz.com.reduce.R.color.mcommon_blue;


/**
 * Created by qingshengzheng on 15/7/21.
 */
public class DoorBtn extends RelativeLayout {

    private int index;
    private int backgroundid;
    private int resId_unsel;
    private TextView imageView;
    private TextView textView;
    private LinearLayout doorLayout;
    private OnClickListener listener;

    public DoorBtn(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    public DoorBtn(Context context) {
        super(context);
        this.setGravity(Gravity.CENTER);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view=inflater.inflate(R.layout.custom_door_btn, null);
        imageView = (TextView) view.findViewById(R.id.door_btn_image);
        textView = (TextView) view.findViewById(R.id.door_btn_titile);
        doorLayout = (LinearLayout)view. findViewById(R.id.door_layout);
       /* RelativeLayout.LayoutParams lp=new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        doorLayout.setLayoutParams(lp);*/
        this.addView(view);

    }

    public void setImageAndTitle(String top, String title) {
        imageView.setText(top);
        textView.setText(title);
    }
    public void setSelect() {
        textView.setTextColor(getResources().getColor(R.color.main_blue));
        imageView.setTextColor(getResources().getColor(R.color.main_blue));
        //Picasso.with(DoorBtn.this.getContext()).load(resId_sel).into(imageView);
    }

    public void setUnSelect() {
        textView.setTextColor(getResources().getColor(R.color.text_gray2));
        imageView.setTextColor(getResources().getColor(R.color.text_gray2));
       // Picasso.with(DoorBtn.this.getContext()).load(resId_unsel).into(imageView);
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
